home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_m_p / mews11.zip / MSWIN.H < prev    next >
C/C++ Source or Header  |  1992-08-16  |  8KB  |  212 lines

  1. /* This file provides definitions for the C source and resource scripts
  2.    for support of operation under the Microsoft Windows environment on
  3.    an IBM-PC or compatible computer.
  4.  
  5.    Must be compiled with Borland C++ 2.0 or MSC 6.0 or later versions
  6.  
  7.    It should not be compiled if the WINDOW_MSWIN symbol is not set */
  8.  
  9. /* compile flags */
  10. #define GRINDERS    8   /* 0 to use the hourglass, 8 to use the animated
  11.                            grinder (8 is the number of animation steps) */
  12.                            
  13. #define WIN30SDK    0   /* 1 to be compatible with the Windows 3.0 SDK */
  14.  
  15. #define BLOCKCARET  1   /* 1 to have a cell-sized caret when within a
  16.                screen, 0 for a vertical bar */
  17.  
  18. #define MEMTRACE    1   /* adds a debugging trace to mswmem.c (used only
  19.                            if SUBALLOC (below) is 1) */
  20.  
  21. /* The SUBALLOC #define implements malloc/free/realloc by segment
  22.    suballocation routines (needed for Borland C 2.0, but not necessary
  23.    under Borland C 3.0). Not needed under MSC 7.0 either. */
  24. #if WINDOW_MSWIN32
  25. #define SUBALLOC    0
  26. #else
  27. #if     TURBO
  28. #if         defined(__BORLANDC__) && (__TURBOC__<0x300)
  29. #define SUBALLOC    1   /* BC++ 2.0 */
  30. #else
  31. #define SUBALLOC    0   /* TC++ 1.0 or BC++ 3.x */
  32. #endif
  33. #endif
  34. #if     MSC
  35. #if         _MSC_VER < 700
  36. #define SUBALLOC    1
  37. #else
  38. #define SUBALLOC    0
  39. #endif
  40. #endif
  41. #endif
  42.  
  43. #if !WIN30SDK
  44. #include    <shellapi.h>
  45. #endif
  46.  
  47. #include    "mswrid.h"  /* contains all the Resource IDs */
  48.  
  49. /* SDK-compatibility (Win3.0, Win3.1, WIN32) */
  50. #if WIN30SDK
  51. #define UINT    WORD
  52. #define MDITILE_VERTICAL    0x0000
  53. #define MDITILE_HORIZONTAL  0x0001
  54. #endif
  55. #if WINDOW_MSWIN32
  56. #define LPDATA(p) ((LPARAM)(LPSTR)(p))
  57. #define HDROP HANDLE
  58. #define NOTIFICATION_CODE HIWORD(wParam)    /* for WM_COMMAND parsing */
  59. #else
  60. #define LPDATA(p) ((LPSTR)(p))
  61. #define NOTIFICATION_CODE HIWORD(lParam)
  62. #define WNDPROC FARPROC
  63. #endif
  64.  
  65. /* macros */
  66. #define MLSIZE  NSTRING         /* message line buffer size */
  67.  
  68. /* offsets for the screen windows extra bytes */
  69. #define GWL_SCRPTR  0                   /* SCREEN structure pointer */
  70. #define GWW_SCRCX   (GWL_SCRPTR+sizeof(LONG))   /* client area width */
  71. #define GWW_SCRCY   (GWW_SCRCX+sizeof(WORD))       /* client area height */
  72. #define SCRWNDEXTRA (GWW_SCRCY+sizeof(WORD))
  73.  
  74. /* offsets for the frame window extra bytes */
  75. #define GWW_FRMID   0                   /* Id seen by other emacs apps */
  76. #define FRMWNDEXTRA (GWW_FRMID+sizeof(WORD))
  77.  
  78. /* structures */
  79. typedef struct  CellMetrics {   /* coordinate-related parameters of a font */
  80.     short   OffsetX, OffsetY;  /* offset of column 0 or row 0, relative
  81.                   to the client area upper left corner */
  82.     short   LeadingY, HalfLeadingY; /* external leading between rows */
  83.     short   SizeX, SizeY;       /* character cell size */
  84.     short   MLHeight;           /* height of the message line */
  85. } CellMetrics;
  86.  
  87. #ifdef  termdef     /* in mswdrv.c only */
  88. char    ProgName [] = PROGNAME;
  89. int     CurrentRow = 0;
  90. int     CurrentCol = 0;
  91. BOOL    MouseTracking = FALSE;
  92. BOOL    InternalRequest = FALSE;
  93. BOOL    TakingANap = FALSE;
  94.  
  95. /* Global uninitialized variables */
  96. HWND    hFrameWnd;          /* main (frame) window */
  97. HWND    hMDIClientWnd;      /* MDI client window */
  98. HANDLE  hEmacsInstance;     /* module instance */
  99. BOOL    Win386Enhanced;     /* Windows 386 enhanced mode */
  100. BOOL    Win31API;           /* Windows 3.1 or later version */
  101. HCURSOR hScreenCursor, hTrackCursor, hNotQuiescentCursor, hHourglass;
  102. char    *ScreenClassName;   /* MDI childs class name */
  103. char    *MLBuf;             /* message line buffer */
  104. HFONT   hEmacsFont;         /* font used for display */
  105. CellMetrics     EmacsCM;    /* cell metrics of that font */
  106.  
  107. char    *MainHelpFile;      /* Emac's help file name and useage flag */
  108. BOOL    MainHelpUsed;
  109.  
  110. char    HelpEngineFile [NFILEN];/* user help file and useage flag */
  111. BOOL    ColorDisplay;       /* TRUE if the display is color-capable */
  112.  
  113. #if GRINDERS != 0
  114. HCURSOR GrinderCursor [GRINDERS];/* handles for the grinder animation */
  115. int     GrinderIndex;
  116. #endif
  117. #else
  118. extern char ProgName [DUMMYSZ];/* used all over the place for captions,
  119.                       etc... */
  120. extern int  CurrentRow;
  121. extern int  CurrentCol;     /* caret positions (in text coordinates) */
  122. extern BOOL MouseTracking;  /* TRUE if mouse in tracking/dragging mode */
  123. extern BOOL InternalRequest;
  124.     /* TRUE for a request that originates from the mswxxx modules. This
  125.        is meant to avoid infinite recursions for requests that could
  126.        come from both MS-Windows or the editor's core (for instance
  127.        resizing, screen activation...) */
  128. extern BOOL TakingANap;     /* TRUE during execution of TakeANap() */
  129.  
  130. /* Global uninitialized variables */
  131. extern HWND    hFrameWnd;          /* main (frame) window */
  132. extern HWND    hMDIClientWnd;      /* MDI client window */
  133. extern HANDLE  hEmacsInstance;     /* module instance */
  134. extern BOOL    Win386Enhanced;     /* Windows 386 enhanced mode */
  135. extern BOOL    Win31API;           /* Windows 3.1 or later version */
  136. extern HCURSOR hScreenCursor, hTrackCursor, hNotQuiescentCursor, hHourglass;
  137. extern char    *ScreenClassName;   /* MDI childs class name */
  138. extern char    *MLBuf;             /* message line buffer */
  139. extern HFONT   hEmacsFont;         /* font used for display */
  140. extern CellMetrics     EmacsCM;    /* cell metrics of that font */
  141.  
  142. extern char    *MainHelpFile;      /* Emac's help file name and useage flag */
  143. extern BOOL    MainHelpUsed;
  144.  
  145. extern char    HelpEngineFile [NFILEN];/* user help file and useage flag */
  146. extern BOOL    ColorDisplay;       /* TRUE if the display is color-capable */
  147.  
  148. #if GRINDERS != 0
  149. extern HCURSOR GrinderCursor [GRINDERS];/* handles for the grinder animation */
  150. extern int     GrinderIndex;
  151. #endif
  152. #endif
  153.  
  154. /* input stream access functions */
  155. void in_init (void);
  156. BOOL in_room (int n);
  157. BOOL in_check (void);
  158. void in_put (int event);
  159. int  in_get (void);
  160.  
  161. /* Windows-implementation specific functions */
  162. LONG EXPORT FAR PASCAL ScrWndProc (HWND hWnd, UINT wMsg, UINT wParam,
  163.                    LONG lParam);
  164. LONG EXPORT FAR PASCAL FrameWndProc (HWND hWnd, UINT wMsg, UINT wParam,
  165.                      LONG lParam);
  166. int FAR PASCAL GetInput (void);
  167. int FAR PASCAL TakeANap (int t);
  168.  
  169. void FAR PASCAL GenerateMenuSeq (UINT ID);
  170. KEYTAB * FAR PASCAL FindKeyBinding (void *Func);
  171. void FAR PASCAL InitMenuPopup (HMENU hMenu, LONG lParam);
  172. BOOL FAR PASCAL MenuCommand (UINT wParam, LONG lParam);
  173. HMENU FAR PASCAL GetScreenMenuHandle (void);
  174.  
  175. BOOL FAR PASCAL EatKey (UINT MsgCode, UINT wParam, LONG lParam);
  176. void FAR PASCAL MouseMessage (HWND hWnd, UINT wMsg, UINT wParam, LONG lParam);
  177. #if !WIN30SDK
  178. void FAR PASCAL DropMessage (HWND hWnd, HANDLE hDrop);
  179. #endif
  180.  
  181. void FAR PASCAL BuildCellMetrics (CellMetrics *cm, HFONT hFont);
  182. void FAR PASCAL InvalidateCells (HWND hWnd, int leftcol, int toprow,
  183.                                  int rightcol, int bottomrow);
  184. void FAR PASCAL MinimumClientSize (HWND hWnd, int NCols, int NRows,
  185.                    int *Width, int *Height);
  186. int FAR PASCAL DisplayableRows (HWND hWnd, int Height, CellMetrics *cm);
  187. int FAR PASCAL DisplayableColumns (HWND hWnd, int Width, CellMetrics *cm);
  188. void FAR PASCAL EmacsCaret (BOOL Show);
  189. void FAR PASCAL MoveEmacsCaret (HWND hWnd, int col, int row);
  190. void FAR PASCAL ShowEmacsCaret (BOOL Show);
  191. void FAR PASCAL CellToClient (HWND hWnd, POINT Cell, LPPOINT Client);
  192. void FAR PASCAL ClientToCell (HWND hWnd, POINT Client, LPPOINT Cell);
  193. void FAR PASCAL GetMinMaxInfo (HWND hWnd, LPPOINT rgpt);
  194. BOOL FAR PASCAL ScrReSize (HWND hWnd, UINT wParam, WORD cx, WORD cy);
  195. void FAR PASCAL ScrPaint (HWND hWnd);
  196. void FAR PASCAL MLPaint (void);
  197.  
  198. BOOL FAR PASCAL InMessageLine (void);
  199.  
  200. void FAR PASCAL ClipboardCleanup (void);
  201. void FAR PASCAL ScrollMessage (HWND hWnd, UINT wMsg, WORD ScrlCode, int Pos);
  202. void FAR PASCAL ScrollBars (void);
  203.  
  204. int FAR PASCAL SetWorkingDir (void);
  205.  
  206. void FAR PASCAL InitializeFarStorage (void);
  207. void FAR PASCAL JettisonFarStorage (void);
  208.  
  209. HFONT FAR PASCAL SelectFont (HDC hDC, HFONT hFont);
  210. BOOL FAR PASCAL PickEmacsFont (void);
  211. void FAR PASCAL FontInit (void);
  212.